package com.ruoyi.energize.service.impl;

import java.time.LocalDateTime;
import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.energize.domain.YancaoCategorySaleReport;
import com.ruoyi.energize.domain.YancaoStoreDailySalesReport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.energize.mapper.CashOrderGoodsMapper;
import com.ruoyi.energize.domain.CashOrderGoods;
import com.ruoyi.energize.service.ICashOrderGoodsService;

/**
 * 订单商品信息表Service业务层处理
 *
 * @author ruoyi
 * @date 2023-05-26
 */
@DataSource(DataSourceType.ZJPAY)
@Service
public class CashOrderGoodsServiceImpl implements ICashOrderGoodsService
{
    @Autowired
    private CashOrderGoodsMapper cashOrderGoodsMapper;

    /**
     * 查询订单商品信息表
     *
     * @param autoId 订单商品信息表主键
     * @return 订单商品信息表
     */
    @Override
    public CashOrderGoods selectCashOrderGoodsByAutoId(Long autoId)
    {
        return cashOrderGoodsMapper.selectCashOrderGoodsByAutoId(autoId);
    }

    /**
     * 查询订单商品信息表列表
     *
     * @param cashOrderGoods 订单商品信息表
     * @return 订单商品信息表
     */
    @Override
    public List<CashOrderGoods> selectCashOrderGoodsList(CashOrderGoods cashOrderGoods)
    {
        return cashOrderGoodsMapper.selectCashOrderGoodsList(cashOrderGoods);
    }
    /**
     * 统计出收银订单包含烟草数量订单和纯烟草销售价格
     */
    @DataSource(DataSourceType.ZJPAY)
    @Override
    public List<YancaoStoreDailySalesReport> selectCashOrderGoodsListByDate(LocalDateTime dateTimeMin, LocalDateTime dateTimeMax){
        return cashOrderGoodsMapper.selectCashOrderGoodsListByDate(dateTimeMin,dateTimeMax);
    }

    /**
     * 新增订单商品信息表
     *
     * @param cashOrderGoods 订单商品信息表
     * @return 结果
     */
    @Override
    public int insertCashOrderGoods(CashOrderGoods cashOrderGoods)
    {
        return cashOrderGoodsMapper.insertCashOrderGoods(cashOrderGoods);
    }

    /**
     * 修改订单商品信息表
     *
     * @param cashOrderGoods 订单商品信息表
     * @return 结果
     */
    @Override
    public int updateCashOrderGoods(CashOrderGoods cashOrderGoods)
    {
        return cashOrderGoodsMapper.updateCashOrderGoods(cashOrderGoods);
    }

    /**
     * 批量删除订单商品信息表
     *
     * @param autoIds 需要删除的订单商品信息表主键
     * @return 结果
     */
    @Override
    public int deleteCashOrderGoodsByAutoIds(Long[] autoIds)
    {
        return cashOrderGoodsMapper.deleteCashOrderGoodsByAutoIds(autoIds);
    }

    /**
     * 删除订单商品信息表信息
     *
     * @param autoId 订单商品信息表主键
     * @return 结果
     */
    @Override
    public int deleteCashOrderGoodsByAutoId(Long autoId)
    {
        return cashOrderGoodsMapper.deleteCashOrderGoodsByAutoId(autoId);
    }

    /**
     * 获取分类占比报告
     * @return
     */
    @DataSource(DataSourceType.ZJPAY)
    @Override
    public List<YancaoCategorySaleReport> selectYancaoCategorySaleReportList(YancaoCategorySaleReport yancaoCategorySaleReport){
        return cashOrderGoodsMapper.selectYancaoCategorySaleReportList(yancaoCategorySaleReport);
    }

    @DataSource(DataSourceType.ZJPAY)
    @Override
    public List<CashOrderGoods> listCigaretteSalesBydate(CashOrderGoods cashOrderGoods){
        return cashOrderGoodsMapper.listCigaretteSalesBydate(cashOrderGoods);
    }

    @DataSource(DataSourceType.ZJPAY)
    @Override
    public List<CashOrderGoods> getCigarettePriceRange(CashOrderGoods cashOrderGoods){
        return cashOrderGoodsMapper.getCigarettePriceRange(cashOrderGoods);
    }
}
